'''
Created on May 20, 2011

@author: james
'''

class AggregateCall:
    def __init__(self, display = False):
        self.output = ""
        self.total = 0
        
    def mapCalls(self, x):
        self.output += "%d, " % x
        self.total += x
        
    def mapMonth(self, x):
        a = AggregateCall()
        map(a.mapCalls, x)
        self.output += "%s = %d, " % (a.output, a.total)
        self.total += a.total
        return self.total
        
    def mapDoctor(self, x):
        a = AggregateCall()
        map(a.mapMonth, x)
        self.output = "%s = %d, " % (a.output, a.total)
        self.total += a.total
        
        #if self.display: print self.output
        
    @staticmethod
    def sumCalls(x):
        callCounts = [0, 0, 0, 0]
        for m in x:
            for i in range(len(m)):
                callCounts[i] += m[i]
        return callCounts
